<?php
class cxml {
	var $classname="xml类";
	var $str_xmlfilename;
	var $str_xmlcontent;
    var $handle_xmlparser;
	var $xmlarr;
    function __construct($xmlfilename){
	$this->classname ="rename_xml类";
	$this->str_xmlfilename=$xmlfilename;
	$this->handle_xmlparser = xml_parser_create_ns();
	$this->get_xmlcontent();
	}
	
	function get_xmlcontent(){
	    $fp = fopen($this->str_xmlfilename, 'r');
        $this->str_xmlcontent = fread($fp, 4096);
		return $this->str_xmlcontent;
	}
	function par_into_array(){
	   xml_parse_into_struct($this->handle_xmlparser,$this->str_xmlcontent,$this->xmlarr);	
	   $this->free();
	   return $this->xmlarr;
	}	
	function free(){
	xml_parser_free($this->handle_xmlparser);	
	echo '<br>free'.'</br>';
	}
	function info(){
	$info[0]=get_class("cxml");//取得当前语句所在类的类名
    $info[methods]=get_class_methods("cxml");//取得class name 类的所有的方法名，并且组成一个数组
    $info[vars]=get_class_vars("cxml");
	$info[classname]=$this->classname;
	$info[str_xmlfilename]=$this->str_xmlfilename;
	$info[str_handle_xmlparser]=$this->handle_xmlparser;
	//$info[xmlarr]=$this->xmlarr;
	return $info;
	}
}
?>